package com.zhsh.generator.template.config;

import com.zhsh.generator.common.utils.StrKit;
import com.zhsh.generator.common.utils.ToolUtil;
import lombok.Data;

/**
 * 全局配置
 *
 * @author fengshuonan
 * @date 2020-02-24 20:21
 */
@Data
public class ContextConfig {

    /**
     * 模板输出的项目目录
     */
    private String projectPath = "D:\\ideaSpace\\yjc-generator";
    /**
     * 业务名称
     */
    private String bizChName;
    /**
     * 业务英文名称
     */
    private String bizEnName;
    /**
     * 业务英文名称(大写)
     */
    private String bizEnBigName;
    /**
     * 模块名称
     */
    private String moduleName = "system";
    /**
     * 包名称前缀
     */
    private String templateFilePrefix = "com.jd.jying";

    /**
     * 是否生成控制器代码开关
     */
    private Boolean controllerSwitch = true;

    /**
     * service
     */
    private Boolean serviceSwitch = true;

    public void setBizEnName(String bizEnName) {
        this.bizEnName = bizEnName;
        this.bizEnBigName = ToolUtil.firstLetterToUpper(this.bizEnName);
    }

    public String getTemplateFilePrefixWithLine () {
        return StrKit.packNamePoint2Line(templateFilePrefix);
    }

    public String getPackagePath () {
        return this.getTemplateFilePrefix() + "." + this.getModuleName() + ".";
    }
}
